﻿using Max.PH6_2009A.LowCode.DTO;
using Max.PH6_2009A.LowCode.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Max.PH6_2009A.LowCode.API.Controllers
{
    [Route("menu")]
    [ApiController]
    public class MenuController : ControllerBase
    {
        IMenuService _service;

        public MenuController(IMenuService service)
        {
            _service = service;
        }

        /// <summary>
        /// 递归菜单
        /// </summary>
        /// <returns></returns>
        [HttpGet("recursion")]
        public IActionResult RecursionMenu()
        {
            ResponseResultDto dto = new();
            var data = _service.GetRecursionMenu();
            dto.Data = data;
            return Ok(dto);
        }



        [HttpGet("test")]
        public IActionResult Teset(string menuid)
        {

            return Ok();
        }

        private void GetAll(string mid)
        {
            MenuRecursionOutputDto dto = new();

            var m = _service.Select().Where(x => x.ToString().Equals(mid)).FirstOrDefault();
            if(m.Pid != Guid.Empty)
            {
                
            }
        }
    }
}
